const local = {
  set: (key: string, value: (string | Record<string, any>)) => {
    localStorage.setItem(key, JSON.stringify(value));
  },
  getObject: (key: string) => {
    return JSON.parse(localStorage.getItem(key) as string);
  },
  get: (key: string) => {
    return localStorage.getItem(key) as string;
  },
  remove: (key: string) => {
    localStorage.removeItem(key);
  },
  clear: () => {
    localStorage.clear();
  },
};
const session = {
  set: (key: string, value: (string | Record<string, any>)) => {
    sessionStorage.setItem(key, JSON.stringify(value));
  },
  getObject: (key: string) => {
    return JSON.parse(sessionStorage.getItem(key) as string);
  },
  get: (key: string) => {
    return sessionStorage.getItem(key) as string;
  },
  remove: (key: string) => {
    sessionStorage.removeItem(key);
  },
  clear: () => {
    sessionStorage.clear();
  },
};

export { local, session };
